<template>
	<view class="wrap">
		<u-form>
			<u-form-item label="学号">
				<u-input v-model="form.studentId" />
			</u-form-item>
			<u-form-item label="姓名">
				<u-input v-model="form.name" />
			</u-form-item>
		</u-form>
		<view style="padding:16rpx 0">
			<u-button type="primary" @click="bind">绑定</u-button>
		</view>
	</view>
</template>
<script setup>
	import {
		ref
	} from 'vue'
	const form = ref({
		studentId: '',
		name: ''
	})

	function bind() {
		if (!form.value.studentId || !form.value.name) return uni.showToast({
			title: '请填写完整',
			icon: 'none'
		})
		uni.setStorageSync('profile', form.value);
		uni.showToast({
			title: '绑定成功',
			icon: 'success'
		})
	}
</script>
<style scoped>
	.wrap {
		padding: 16rpx
	}
</style>
